{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2023, OpenNebula Project, OpenNebula Systems                }}
{{!                                                                            }}
{{! Licensed under the Apache License, Version 2.0 (the "License"); you may    }}
{{! not use this file except in compliance with the License. You may obtain    }}
{{! a copy of the License at                                                   }}
{{!                                                                            }}
{{! http://www.apache.org/licenses/LICENSE-2.0                                 }}
{{!                                                                            }}
{{! Unless required by applicable law or agreed to in writing, software        }}
{{! distributed under the License is distributed on an "AS IS" BASIS,          }}
{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   }}
{{! See the License for the specific language governing permissions and        }}
{{! limitations under the License.                                             }}
{{! -------------------------------------------------------------------------- }}
<div class="row">
  <div class="medium-12 columns text-center">
    {{{leases}}}
  </div>
</div>
<div class="row">
  <div id="template_name_form" class="medium-6 columns">
    <label  for="NAME">
      {{tr "Name"}}
      <input type="text" wizard_field="NAME" id="NAME" required/>
    </label>
  </div>
  <div  id="template_hypervisor_form" class="medium-6 columns">
    <label>{{tr "Hypervisor"}}</label>
    <input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="kvm" id="kvmRadio">
    <label for="kvmRadio">{{tr "KVM"}}</label>
    <input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="vcenter" id="vcenterRadio">
    <label for="vcenterRadio">{{tr "vCenter"}}</label>
    <input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="lxc" id="lxcRadio">
    <label for="lxcRadio">{{tr "LXC"}}</label>
    <input type="radio" wizard_field="HYPERVISOR" name="hypervisor" value="firecracker" id="firecrackerRadio">
    <label for="firecrackerRadio">{{tr "Firecracker"}}</label>
  </div>
</div>
<div class="row">
  <div class="medium-6 columns">
    <label  for="DESCRIPTION">
      {{tr "Description"}}
    </label>
    <textarea type="text" wizard_field="DESCRIPTION" id="DESCRIPTION" name="DESCRIPTION" style="height: 70px;"/>
  </div>
  <div class="medium-6 columns">
    <div class="row">
      <div class="medium-6 columns">
        <label  for="LOGO">
          {{tr "Logo"}}
        </label>
        <select wizard_field="LOGO" id="LOGO" name="LOGO">
          <option value=""></option>
          {{#each logos}}
          <option value="{{path}}">{{name}}</option>
          {{/each}}
        </select>
      </div>
      <div id="template_create_logo" class="text-center medium-6 columns" style="margin-bottom: 15px"></div>
      <br></div>
  </div>
</div>
<div class="row">
  <div class="capacityCreate large-12 columns">{{{capacityCreateHTML}}}</div>
</div>
<fieldset class="hypervisor only_vcenter" style="display: none;">
  <legend>{{tr "vCenter"}}</legend>
  <div class="row hypervisor only_vcenter" style="display: none;">
    <div class="medium-6 columns">
      <label  for="vcenter_template_ref">
        {{tr "vCenter Template Ref"}}
      </label>
      <input type="text" id="vcenter_template_ref"/>
    </div>
  </div>
  <div class="row hypervisor only_vcenter" style="display: none;">
    <div class="medium-6 columns">
      <label  for="vcenter_ccr_ref">
        {{tr "vCenter Cluster Ref"}}
      </label>
      <input type="text" id="vcenter_ccr_ref"/>
    </div>
    <div class="medium-6 columns">
      <label  for="vcenter_instance_id">
        {{tr "vCenter Instance ID"}}
      </label>
      <input type="text" id="vcenter_instance_id"/>
    </div>
  </div>
  <div class="vcenter_rp_input row">
     <div class="large-3 medium-6 columns">
       <label>
         {{tr "Default Resource Pool"}}
         <input type="text" class="initial_rp" value="{{resourcePool.initial}}"/>
       </label>
     </div>
     <div class="large-3 medium-6 columns">
       <label>
         {{tr "Type"}}
         <select class="modify_rp">
           <option value="fixed">{{tr "Fixed"}}</option>
           <option value="list">{{tr "Provide on instantiation"}}</option>
         </select>
       </label>
     </div>
     <div class="large-6 medium-12 columns">
       <label>
         {{tr "Available Resource Pools"}}
         <input type="text" class="available_rps" value="{{resourcePool.params}}"/>
       </label>
     </div>
 </div>
  <div class="vcenter_vm_folder_input row">
    <div class="medium-6 columns">
      <label  for="vcenter_vm_folder">
        {{tr "vCenter VM Folder"}}
        {{{tip (tr "If specified, the the VMs and Template folder path where the VM will be created inside the data center. The path is delimited by slashes e.g /Management/VMs. If no path is set the VM will be placed in the same folder where the template is located.")}}}
      </label>
      <input type="text" id="vcenter_vm_folder"/>
    </div>
  </div>
</fieldset>
<fieldset class="hypervisor only_lxc" style="display: none;">
  <legend>{{tr "LXC"}}</legend>
  <div class="row">
    <div class="medium-6 columns">
      <label  for="lxc_security_unprivileged">
        {{tr "Unprivileged mode"}}
      </label>
      <select id="lxc_security_unprivileged">
         <option selected="selected" value="yes">Yes</option>
         <option value="no">No</option>
      </select>
    </div>
  </div>
</fieldset>
{{#isFeatureEnabled "showback"}}
<div class="row">
  <div class="medium-12 columns">
    <fieldset>
      <legend>
        {{tr "Cost"}}
        <span>
          <span id="total_cost"></span>
          <small>{{tr "COST"}} / {{tr "MONTH"}}</small>
        </span>
      </legend>
      <div class="medium-4 columns">
        <label  for="MEMORY_COST">
          {{tr "Memory"}}
            {{{tip (tr "Cost of each MB or GB per hour")}}}
        </label>
        <div class="input-group" style="margin-bottom:0;">
          <input type="number" step="any" min="0" wizard_field="MEMORY_COST" id="MEMORY_COST"/>
          <div class="input-group-button">
              <select id="MEMORY_UNIT_COST" wizard_field="MEMORY_UNIT_COST" class="mb_input_unit">
                <option value="MB" selected>{{tr "MB"}}</option>
                <option value="GB" >{{tr "GB"}}</option>
              </select>
            </div>
        </div>
        <div class="target_cost" align="center" style="background-color:lightgrey;">
          <label class="total_memory_cost" hidden="true">{{tr "TOTAL"}}</label>
          <label class="total_memory_cost" style="font-size:200%;" id="total_value_memory" hidden="true"></label>
          <label class="total_memory_cost" hidden="true">/{{tr "month"}}
          </label>
        </div>
      </div>
      <div class="medium-4 columns">
        <label  for="CPU_COST">
          {{tr "CPU"}}
            {{{tip (tr "Cost of each CPU per hour")}}}
        </label>
        <input type="number" step="any" min="0" wizard_field="CPU_COST" id="CPU_COST"/>
        <span></span>
         <div class="target_cost" align="center" style="background-color:lightgrey;">
          <label class="total_cpu_cost" hidden="true">{{tr "TOTAL"}}</label>
          <label class="total_cpu_cost" style="font-size:200%;" id="total_value_cpu" hidden="true"></label>
          <label class="total_cpu_cost" hidden="true">/{{tr "month"}}</label>
        </div>
      </div>
      <div class="medium-4 columns left">
        <label  for="DISK_COST">
          {{tr "Disk"}}
            {{{tip (tr "Cost of each GB per hour")}}}
        </label>
        <input type="number" step="any" min="0" wizard_field="DISK_COST" id="DISK_COST"/>
        <div class="target_cost" align="center" style="background-color:lightgrey;">
          <label class="total_disk_cost" hidden="true">{{tr "TOTAL"}}</label>
          <label class="total_disk_cost" style="font-size:200%;" id="total_value_disk" hidden="true"></label>
          <label class="total_disk_cost" hidden="true">/{{tr "month"}}</label>
        </div>
      </div>
    </fieldset>
  </div>
</div>
{{/isFeatureEnabled}}
<div class="row">
  <div class="large-6 columns">
    <input type="checkbox" id="sunstone_network_select"/>
    <label  for="sunstone_network_select">
      {{tr "Do not allow to modify network configuration"}}
      {{{tip (tr "Users will not be able to remove or add new NICs")}}}
    </label>
  </div>
</div>
<div class="row">
  <div class="large-12 columns">
    <input type="checkbox" wizard_field="VROUTER" id="VROUTER" value="YES"/>
    <label  for="VROUTER">
      {{tr "Make this template available for Virtual Router machines only"}}
      {{{tip (tr "Virtual Routers create Virtual Machines from a source Template. This checkbox makes this template available to be selected in the New Virtual Router wizard")}}}
    </label>
  </div>
</div><br><br>
{{#advancedSection (tr "User / Group") }}
{{#isFeatureEnabled "show_as_uid_instantiate"}}
<div class="row">
  <div class="small-12 columns usersContext{{element.ID}}">
    <fieldset>
      <legend>
        <i class="fas fa-user"></i> {{tr "Instantiate as a different user"}}
      </legend>
      <div class="provision_uid_selector{{element.ID}}">{{{usersDatatable}}}</div>
    </fieldset>
  </div>
</div>
{{/isFeatureEnabled}}
{{#isFeatureEnabled "show_as_gid_instantiate"}}
<div class="row">
  <div class="small-12 columns groupContext{{element.ID}}">
    <fieldset>
      <legend>
        <i class="fas fa-users"></i> {{tr "Instantiate as a different group"}}
      </legend>
      <div class="provision_gid_selector{{element.ID}}">{{{groupDatatable}}}</div>
    </fieldset>
  </div>
</div>
{{/isFeatureEnabled}}
{{/advancedSection}}
